package com.tyk.bookstore.front.storage.repository;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tyk.bookstore.front.storage.model.dto.StockMeetDto;
import com.tyk.bookstore.front.storage.model.entity.StockDo;
import com.tyk.bookstore.front.storage.model.query.Stock4OrderDeductQuery;
import com.tyk.bookstore.front.storage.model.query.Stock4OrderRollBackQuery;
import com.tyk.bookstore.front.storage.model.query.Stock4OrderStockMeetQuery;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface StockRepository extends BaseMapper<StockDo> {
    /**
     * 回滚库存
     */
    void rollBack(@Param("rbqList") List<Stock4OrderRollBackQuery> rbqList);

    /**
     * 扣减库存
     */
    void deduct(@Param("dpList") List<Stock4OrderDeductQuery> dpList);

    /**
     * 获取严格满足要求的库存记录
     */
    List<StockMeetDto> selectStockMeetListWithStrict(@Param("smqList") List<Stock4OrderStockMeetQuery> smqList);
}
